#ifndef __SOFT_SPI_H
#define __SOFT_SPI_H
#include "main.h"

#define SSPI_CS_PIN    SPI1_NSS_Pin
#define SSPI_CS_GPIO   SPI1_NSS_GPIO_Port

#define SSPI_SCK_PIN   SPI1_SCK_Pin
#define SSPI_SCK_GPIO  SPI1_SCK_GPIO_Port

#define SSPI_MISO_PIN   SPI1_MISO_Pin
#define SSPI_MISO_GPIO  SPI1_MISO_GPIO_Port

#define SSPI_MOSI_PIN		SPI1_MOSI_Pin
#define SSPI_MOSI_GPIO  SPI1_MOSI_GPIO_Port

#define SSPI_CS_LOW 		(SSPI_CS_GPIO->BRR = SSPI_CS_PIN)
#define SSPI_CS_HIGH 		(SSPI_CS_GPIO->BSRR = SSPI_CS_PIN)

#define SSPI_SCK_LOW 		(SSPI_SCK_GPIO->BRR = SSPI_SCK_PIN)
#define SSPI_SCK_HIGH 		(SSPI_SCK_GPIO->BSRR = SSPI_SCK_PIN)

#define SSPI_MOSI_LOW 		(SSPI_MOSI_GPIO->BRR = SSPI_MOSI_PIN)
#define SSPI_MOSI_HIGH 		(SSPI_MOSI_GPIO->BSRR = SSPI_MOSI_PIN)

#define SSPI_MISO_READ 		(SSPI_MISO_GPIO->IDR & SSPI_MISO_PIN)


void SOFT_SPI_Init(void);
void 		SPI_WriteByte(uint8_t TxData);
uint8_t SPI_ReadByte(void);
uint8_t SPI_WriteReadByte(uint8_t TxData);
#endif
